#include <QQmlApplicationEngine>
#include "QApplication"

#include <QTextCodec>
#include "QObject"

#include <QMessageBox>
#include <QString>
#include "qmlcppslotsignal.h"
//============================================================

QString type = nullptr;

int main(int argc, char *argv[])
{
    QTextCodec* codec = QTextCodec::codecForName("UTF-8");
    QTextCodec::setCodecForLocale(codec);

    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

    QApplication app(argc, argv);

    QQmlApplicationEngine engine;
    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
    if (engine.rootObjects().isEmpty())
        return -1;

    common = new Common();
    //======================================================
    bool connBool = false;
    QmlCppSlotSignal * qmlcppss = new QmlCppSlotSignal();
    QObject * qmlobj = engine.rootObjects().first();
    //======================================================================
    connBool = QObject::connect(qmlobj, SIGNAL(qmlSignal(QString)), qmlcppss, SLOT(cppSlot(QString)));
    Q_ASSERT(connBool);
    connBool = QObject::connect(qmlcppss, SIGNAL(cppSignal(QVariant)), qmlobj, SLOT(qmlSlot(QVariant)));
    Q_ASSERT(connBool);

//    type = QString("TXT");
//    QString path1 = QString(":/resource/resource/rgev.txt");
//    QString path2 = QString(":/resource/resource/rig.txt");
//    ParseFiles *pf = new ParseFiles(type);
//    if(pf != nullptr){

//        if(pf->RunParse(path1, path2) != 0){
//            Error1("pf->SetPath вернула ошибку.");
//        }
//    }
//    else {
//        Error1("pf не инициализирована.");
//    }

    return app.exec();
}
